{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "from ControlPreprocessHaruhi import *\n",
    "from PIL import Image, ImageDraw\n",
    "import cv2\n",
    "import numpy as np\n",
    "\n",
    "# 从文件名打开图像\n",
    "image_path = 'face.jpg'\n",
    "# image = cv2.imread(image_path)\n",
    "image = Image.open(image_path)\n",
    "np_img = openImage(image)\n",
    "np_img_uint8 = np.round(np_img * 255.0).astype(np.uint8)\n",
    "lsd_img_ = masked_LineartStandardDetector(np_img_uint8)\n",
    "poses = getPoses(np_img_uint8)\n",
    "keypoints = getFaceKeypoints(poses)\n",
    "\n",
    "\n",
    "lsd_img_.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "image = Image.open(image_path)\n",
    "np_img = openImage(image)\n",
    "np_img_uint8 = np.round(np_img * 255.0).astype(np.uint8)\n",
    "lsd_img_ = lsd_img(np_img_uint8)\n",
    "poses = getPoses(np_img_uint8)\n",
    "keypoints = getFaceKeypoints(poses)\n",
    "colored_img = draw_colored_keypoints(keypoints, resolution=512)\n",
    "# colored_img.show()\n",
    "# lsd_img_.show()\n",
    "blended_image = blend_images(colored_img, lsd_img_)\n",
    "blended_image.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "image = Image.open(image_path)\n",
    "np_img = openImage(image)\n",
    "np_img_uint8 = np.round(np_img * 255.0).astype(np.uint8)\n",
    "# lsd_img_ = lsd_img(np_img_uint8)\n",
    "poses = getPoses(np_img_uint8)\n",
    "keypoints = getFaceKeypoints(poses)\n",
    "colored_img = draw_colored_keypoints(keypoints, resolution=512)\n",
    "\n",
    "\n",
    "colored_img.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "image = Image.open(image_path)\n",
    "np_img = openImage(image)\n",
    "np_img_uint8 = np.round(np_img * 255.0).astype(np.uint8)\n",
    "lsd_img_ = masked_LineartStandardDetector(np_img_uint8)\n",
    "poses = getPoses(np_img_uint8)\n",
    "keypoints = getFaceKeypoints(poses)\n",
    "colored_img = draw_colored_keypoints(keypoints, resolution=512)\n",
    "# colored_img.show()\n",
    "# lsd_img_.show()\n",
    "blended_image = blend_images(colored_img, lsd_img_)\n",
    "\n",
    "\n",
    "blended_image.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "pytorch_gpu",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.16"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
